package demo0516;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;
//测试类的命名 原类+Test

public class DemoTest {

	@Test
	public void testSum3() {
		 int x[]= {3,4,5};
		    Demo demo=new Demo();
		   int sum =demo.sum3(x);
		   assertEquals(12, sum);
	}
	
	@Test
	public void testSum3List() {
		List<Integer> nums=new ArrayList<>();
		nums.add(3);
		nums.add(4);
		nums.add(5);
		
		    Demo demo=new Demo();
		   int sum =demo.sum3List(nums);
		   assertEquals(14, sum);
	}
	
	@Test
	public void testSum3List2() {
		Integer[] nums1= {5,6,7,8,9,10,3,45,6,78};
		//asList不能是基本类型  int short 
		List<Integer> nums=Arrays.asList(nums1);
		    Demo demo=new Demo();
		   int sum =demo.sumNList(nums);
		   assertEquals(14, sum);
	}
	
	
	

}
